//继承是多态使用的前提

class Animal {
  action() {
    console.log("Animal action");
  }
}

class Dog extends Animal {
  action() {
    console.log("dog running!!!");
  }
}

class Fish extends Animal {
  action() {
    console.log("fish swimming~~~");
  }
}

//const animals: Animal = new Dog() 父类引用指向子类对象
function makeActions(animals: Animal[]) {
  animals.forEach(animal => {
    animal.action()
  })
} 
makeActions([new Dog(), new Fish()])

export {}